<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      document.write("打印等腰梯形");
      document.write("<br>");
      var n = 8;
      for (var i = 5; i <= n; i++) {
        for (var j = n - i; j > 0; --j) {
          document.write("&nbsp;");
        }
        //先打空格 再打“* ”不能直接打空格 所以打的&nbsp;
        for (var m = i; m > 0; m--) {
          document.write("*&nbsp;");
        }
        document.write("<br>");
      }
      document.write("打印不等腰梯形");
      document.write("<br>");
      var n = 8;
      for (var i = 5; i <= n; i++) {
        for (var j = n - i; j > 0; --j) {
          document.write("&nbsp;");
        }
        //先打空格 再打“* ”不能直接打空格 所以打的&nbsp;
        for (var m = i; m > 0; m--) {
          document.write("&nbsp;*&nbsp;&nbsp;");
        }
        document.write("<br>");
      }
    </script>
  </body>
</html>
